import com.lovo.config.AppConfig;
import com.lovo.model.StudentDO;
import com.lovo.model.UserDO;
import com.lovo.service.impl.StudentService;
import com.lovo.service.impl.UserService;
import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * Description:
 *
 * @author LiuChengQi
 * @date Created on 2020/11/14
 */
public class test {


    @Test
    public void testanyway(){
        //创建spring容器, 注解容器
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(AppConfig.class);

        UserService service = context.getBean(UserService.class);
//        System.out.println(service.register(new UserDO("register1","123")));
        UserDO register = service.login("register", "123");
        System.out.println(register);
//        InvoiceService service = (InvoiceService) context.getBean("invoiceService");
//        service.find();
    }

    @Test
    public void testStudent(){
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(AppConfig.class);
        StudentService service = context.getBean(StudentService.class);
        StudentDO stu = new StudentDO("lcq",2455);
        System.out.println(service.saveStudent(stu));
        System.out.println(service.listStudentAll());
//        StudentDO stu1 = new StudentDO("lcq1q1qq1q",24);
//        stu1.setId((long) 1);
//        System.out.println(service.updateStudent(stu1));
//        System.out.println(service.listStudentAll());
//        System.out.println(service.removeStudentById((long) 1));
//        System.out.println(service.getStudentById((long) 2));
//        System.out.println(service.listStudentAll());


    }

}
